﻿@model IEnumerable<Developer.Entity.Orders>
@{
    Layout = "~/Areas/Admin/Views/Shared/_PopLayout.cshtml";
    var i = 1;
    decimal totalOrigin = 0M;
    decimal totalOrder = 0M;
}
<style>
    .col-sm-10 p {
        line-height: 28px;
    }
</style>
<article class="page-container">
    <form class="form form-horizontal">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-2">用户账号：</label>
            <div class="formControls col-xs-9 col-sm-10">
                <p>@ViewBag.UserAccount</p>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-2">用户详情：</label>
            <div class="formControls col-xs-9 col-sm-10">
                <p><a title="详情" href="javascript:;" onclick="sf_show('详情', '/admin/user/detail/?Id=@ViewBag.UserId', '', '420', true)" class="ml-5 btn btn-primary radius" style="text-decoration: none">详情</a></p>
            </div>
        </div>
        @if (Model.Count() == 0)
        {
            <div class="row cl">
                <label class="form-label col-xs-3 col-sm-2"></label>
                <div class="formControls col-xs-9 col-sm-10">
                    <p>当前用户暂无订单</p>
                </div>
            </div>
        }
        else
        {
            var model_list = Model.GroupBy(a => a.Num);
            foreach (var item in model_list)
            {
                <h3>订单号：@(item.First().Num)</h3>
                <hr />
                <div class="row cl">
                    <label class="form-label col-xs-3 col-sm-2">订购书本：</label>
                    <div class="formControls col-xs-9 col-sm-10"> 
                        @foreach (var order in item)
                        {
                            <a href="/book/detail?bid=@order.BookiId"><span>《@order.Book.Name》  &nbsp;&nbsp;</span></a>
                        }
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-3 col-sm-2">书本原总价：</label>
                    <div class="formControls col-xs-9 col-sm-10">
                        @foreach (var order in item)
                        {
                            totalOrder += (decimal)order.Book.OrderPrice;
                            totalOrigin += (decimal)order.Book.OriginPrice;
                        }
                            <a href=""><span>@totalOrigin  &nbsp;&nbsp;</span></a>
                    </div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-3 col-sm-2">书本预定总价：</label>
                    <div class="formControls col-xs-9 col-sm-10">
                        <a href=""><span>@totalOrder  &nbsp;&nbsp;</span></a>
                    </div>
                </div>




            <div class="row cl">
                <label class="form-label col-xs-3 col-sm-2">订单状态：</label>
                <div class="formControls col-xs-9 col-sm-10"> <p>@(Model.First().State == 1 ? "已完结" : "未完结")</p> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-3 col-sm-2">创建时间：</label>
                <div class="formControls col-xs-9 col-sm-10"><p>@Model.First().CreateTIme</p>  </div>
            </div>

            }
        }

    </form>
</article>